< previous page page_819 next page >

Page 819
Type.gifListing 21.23. Setting up access levels and command buttons.
Private Sub cmdAccess_Click(Index As Integer)
    '
    ' handle user selections
    '
    Select Case Index
        Case 0 ' add object
            accAddObject
        Case 1 ' delete object
            If dtaUserID.Recordset.RecordCount > 0 Then
                accDelObject
            Else
                MsgBox "No objects to Delete", vbExclamation, "Delete Object"
            End If
        Case 2 ' copy all
            accCopyAll
        Case 3 ' erase all
            If dtaUserID.Recordset.RecordCount > 0 Then
                accDelAll
            Else
                MsgBox "No objects to Delete", vbExclamation, "Erase All"
            End If
        Case 4 ' set level
            If dtaUserID.Recordset.RecordCount > 0 Then
                accSetLevel
            Else
                MsgBox "No objects on File", vbInformation, "Set Level"
            End If
    End Select
    '
End Sub
This module calls a set of routines. Each of them handles the real dirty work. You also add some error checking here to make the program a bit more friendly.
To start off, you enter the code that adds an object from the Default Set to the current User's Set. Create a new subroutine called accAddObject and place the code in Listing 21.24 in the routine.
Type.gifListing 21.24. Creating the accAddObject routine.
Public Sub accAddObject()
    '
    ' add an object to the UserID set
    '
    On Error GoTo LocalErr
    '
    Dim strObject As String
continues

 
< previous page page_819 next page >

If you like this book, buy it!